﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Vds2465Telegrams
{
	[TestClass]
	public class UserData_72_DataBlockValid_Test
	{
		[TestMethod]
		[Owner("Frank Eppink")]
		public void Test01_Equals()
		{
			UserData_72_DataBlockValid userData = new UserData_72_DataBlockValid(0x99);

			{
				// completely different type - NOT equal
				object dummyObject = new object();
				Assert.IsFalse(userData.Equals(dummyObject));
			}

			{
				// different derived type 
				UserData_11_Error userData2Compare = new UserData_11_Error(eErrorCode.DataOutOfRange, 0x99);
				Assert.IsFalse(userData.Equals(userData2Compare));
			}

			{
				// same object - equal
				UserData_72_DataBlockValid userData2Compare = new UserData_72_DataBlockValid(userData.Device);
				Assert.IsTrue(userData.Equals(userData2Compare));
			}

			{
				// different property values - NOT equal                
				UserData_72_DataBlockValid userData2Compare = new UserData_72_DataBlockValid((byte)(userData.Device + 1));
				Assert.IsFalse(userData.Equals(userData2Compare));
			}			
		}

		[TestMethod]
		[Owner("Frank Eppink")]
		public void Test02_GetHashCode()
		{
			UserData_72_DataBlockValid userData = new UserData_72_DataBlockValid(0xef);
			int hashCode01 = userData.GetHashCode();
		}

		[TestMethod]
		[Owner("Frank Eppink")]
		public void Test03_ToString()
		{
			UserData_72_DataBlockValid userData = new UserData_72_DataBlockValid(0x51);
			string string01 = userData.ToString();
			Assert.IsNotNull(string01);
		}
	}
}
